package com.example.demo.mapper;

import com.example.demo.model.TestTable;
import com.example.demo.model.UserInfo;
import lombok.Data;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 马拉圈
 * Date: 2023-08-09
 * Time: 21:43
 */

@Mapper
//跟五大类注解@Repository，say 拜拜
public interface UserMapper {
    List<UserInfo> getAll(); //获得所有用户信息

    UserInfo getUserById(Integer id);
    //通过id查找用户

    UserInfo getUserByUsername(@Param("username") String username);
    //通过username查找用户

    List<UserInfo> getAll2(@Param("option") String option);

    UserInfo login(@Param("username") String username, @Param("password") String password);


    int update(UserInfo userInfo);

    //删除状态为state的用户
    int delete(@Param("state") Integer state);

    //增加用户
    int insert(UserInfo userInfo);

    List<TestTable> getT();

    List<UserInfo> getAllLikeSome(@Param("likeString") String likeString);


    //用户注册提交信息
//    int add(UserInfo userInfo);
    int add(String username, String password, Integer state, Integer id);

    int add2(UserInfo userInfo);

    List<UserInfo> select1(UserInfo userInfo);

    int update2(UserInfo userInfo);

    int deleteByIDs(List<Integer> list);

    int insertByUsers(List<UserInfo> list, List<UserInfo> list2);

}
